package com.zeng.sys.authmd.servicemodule.convert;

import com.zeng.nicecore.util.BeanUtil;
import com.zeng.sys.authmd.apimodule.vo.RoleVo;
import com.zeng.sys.authmd.servicemodule.entity.Role;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class RoleVoConvert {

    public List<RoleVo> toList(List<Role> roles) {
        if (roles == null) {
            roles = Collections.emptyList();
        }
        ArrayList<RoleVo> roleVos = new ArrayList<>(roles.size());
        for (Role role : roles) {
            RoleVo roleVo = BeanUtil.beanToVo(role, new RoleVo());
            roleVos.add(roleVo);
        }
        return roleVos;
    }
}
